<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateQiiAppsTable extends Migration
{
    /**
     * Schema table name to migrate
     * @var string
     */
    public $set_schema_table = 'qii_apps';

    /**
     * Run the migrations.
     * @table qii_apps
     *
     * @return void
     */
    public function up()
    {
        if (Schema::hasTable($this->set_schema_table)) return;
        Schema::create($this->set_schema_table, function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->increments('id')->comment('主键');
            $table->string('appname', 40)->comment('模块名或标识');
            $table->string('name', 20)->default('')->comment('中文名');
            $table->text('description')->nullable()->default(null)->comment('模块描述');
            $table->tinyInteger('status')->default('1')->comment('状态');
            $table->longText('config')->nullable()->default(null)->comment('配置');
            $table->longText('dbschema');
            $table->text('events');
            $table->string('author', 40)->nullable()->default('')->comment('作者');
            $table->string('version', 20)->nullable()->default('')->comment('版本号');
            $table->unsignedInteger('create_time')->default('0')->comment('安装时间');
            $table->unsignedTinyInteger('has_adminlist')->default('0')->comment('是否有后台列表');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
     public function down()
     {
       Schema::dropIfExists($this->set_schema_table);
     }
}
